<?php
/**
 * 后台设置关于信息
 * @author caoge
 * @version 2012-8-1
 */
class AboutAction extends AdminBaseAction{
	/**
	 * 关于信息显示(暂时不需要)
	 * 
	 * @author caoge
	 * @version 2012-8-1
	 */
	public function index(){
		
	}
	
	/**
	 * 编辑关于信息
	 * 
	 * @author caoge
	 * @version 2012-8-1
	 */
	public function edit(){
		$aboutId = $this->_get('aboutId','',0);
		if ($aboutId == ''){
			$aboutId = 0;
		}
		$about = isset($_POST['editorValue'])?$_POST['editorValue']:'';
		$about = stripslashes($about); // 防止magic_quotes_gpc参数开启
		$imgUrl = $this->_post('img_url','','');
		if ($about != '' || $imgUrl != ''){
			$data = array('about'=>$about,'img_url'=>$imgUrl);
			$About = D(About);
			if ($aboutId == 0){
				$About->data($data)->add();
				$this->success('添加关于信息成功',__APP__.'/About/edit/');
			}else {
				$condition['id'] = $aboutId;
				$About->where($condition)->data($data)->save();
				$this->success('修改信息成功',__APP__.'/About/edit/');
			}
		}else {
			$About = D(About);
			$aboutInfo = $About->find();
			$this->assign('aboutInfo',$aboutInfo);
			$this->display();
		}
	}
}